// 进销存
import Layout from '@/views/layout/JxcLayout'

const layout = function(meta = {}, path = '/jxc') {
  return {
    path: path,
    component: Layout,
    hidden: false,
    meta: {
      requiresAuth: true,
      ...meta
    }
  }
}

export default [
  {
    ...layout({
      title: '采购管理',
      icon: 'icon-shop-cart'
    }, '/jxc/purchase'),
    children: [
      {
        path: 'supplier',
        component: () => import('@/views/jxc/purchase/supplier/index'),
        meta: {
          title: '供应商',
          requiresAuth: true,
          permissions: ['jxc', 'supplier']
        }
      },
      {
        path: 'order',
        component: () => import('@/views/jxc/purchase/order/index'),
        meta: {
          title: '采购订单',
          requiresAuth: true,
          permissions: ['jxc', 'purchase']
        }
      },
      {
        path: 'returned',
        component: () => import('@/views/jxc/purchase/returned/index'),
        meta: {
          title: '采购退货',
          requiresAuth: true,
          permissions: ['jxc', 'retreat']
        }
      }
    ]
  },
  {
    ...layout({
      requiresAuth: true,
      permissions: ['jxc', 'product']
    }, '/jxc/product'),
    children: [
      {
        path: '',
        component: () => import('@/views/jxc/product/index'),
        meta: {
          title: '产品管理',
          icon: 'product'
        }
      }
    ]
  },
  {
    ...layout({
      title: '销售管理',
      icon: 'icon-sell'
    }, '/jxc/sale'),
    children: [
      {
        path: 'order',
        component: () => import('@/views/jxc/sale/order/index'),
        meta: {
          title: '销售订单',
          requiresAuth: true,
          permissions: ['jxc', 'sale']
        }
      },
      {
        path: 'returned',
        component: () => import('@/views/jxc/sale/returned/index'),
        meta: {
          title: '销售退货',
          requiresAuth: true,
          permissions: ['jxc', 'salereturn']
        }
      }
    ]
  },
  {
    ...layout({
      title: '库存管理',
      icon: 'drafts'
    }, '/jxc/repertory'),
    children: [
      {
        path: 'warehouse',
        component: () => import('@/views/jxc/repertory/warehouse/index'),
        meta: {
          title: '仓库管理',
          requiresAuth: true,
          permissions: ['jxc', 'warehouse']
        }
      },
      {
        path: 'storage',
        component: () => import('@/views/jxc/repertory/storage/index'),
        meta: {
          title: '产品库存',
          requiresAuth: true,
          permissions: ['jxc', 'warehouseProduct']
        }
      },
      {
        path: 'enter',
        component: () => import('@/views/jxc/repertory/enter/index'),
        meta: {
          title: '产品入库',
          requiresAuth: true,
          permissions: ['jxc', 'receipt']
        }
      },
      {
        path: 'out',
        component: () => import('@/views/jxc/repertory/out/index'),
        meta: {
          title: '产品出库',
          requiresAuth: true,
          permissions: ['jxc', 'outbound']
        }
      },
      {
        path: 'move',
        component: () => import('@/views/jxc/repertory/move/index'),
        meta: {
          title: '库存调拨',
          requiresAuth: true,
          permissions: ['jxc', 'allocation']
        }
      },
      {
        path: 'check',
        component: () => import('@/views/jxc/repertory/check/index'),
        meta: {
          title: '库存盘点',
          requiresAuth: true,
          permissions: ['jxc', 'inventory']
        }
      },
      {
        path: 'log',
        component: () => import('@/views/jxc/repertory/log/index'),
        meta: {
          title: '出入库明细',
          requiresAuth: true,
          permissions: ['jxc', 'detailed']
        }
      }
    ]
  },
  {
    ...layout({
      title: '财务管理',
      icon: 'payment'
    }, '/jxc/finance'),
    children: [
      {
        path: 'returned-money',
        component: () => import('@/views/jxc/finance/returnedMoney/index'),
        meta: {
          title: '回款',
          requiresAuth: true,
          permissions: ['jxc', 'collection']
        }
      },
      {
        path: 'payment',
        component: () => import('@/views/jxc/finance/payment/index'),
        meta: {
          title: '付款',
          requiresAuth: true,
          permissions: ['jxc', 'payment']
        }
      }
    ]
  }
]
